package com.example.warehouse.sys.dao.persist.respository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.warehouse.sys.dao.persist.mapper.RolePermissionMapper;
import com.example.warehouse.sys.dao.persist.respository.IRolePermissionRepository;
import com.example.warehouse.sys.pojo.entity.SysRolePermission;
import com.example.warehouse.sys.pojo.vo.RolePermissionVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Slf4j
public class RolePermissionRepositoryImpl implements IRolePermissionRepository {
    public RolePermissionRepositoryImpl() {
        log.info("");
    }

    @Autowired
    private RolePermissionMapper rolePermissionMapper;



    @Override
    public int insert(SysRolePermission sysRolePermission) {
        return rolePermissionMapper.insert(sysRolePermission);
    }

    @Override
    public int deleteByRoleId(Long roleId) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("role_id",roleId);
        return rolePermissionMapper.delete(wrapper);
    }

    @Override
    public List<Long> selectList(Long roleId) {
        return rolePermissionMapper.selectByRoleId(roleId);
    }
}
